package DPT_80;

public class Solution {
	public int removeDuplicates(int[] nums) {
		int i = 1,count=1,lenght =nums.length;
		while (i<lenght) {
			if (nums[i]==nums[i-1]) {
				count++;
				if (count>2) {
					removeEle(nums,i);
					i--;
					lenght--;
				}
			}else {
				count=1;
			}
			i++;
		}
		return lenght;
    }

	private void removeEle(int[] nums, int place) {
		
		for (int i = place+1; i < nums.length; i++) {
			nums[i-1]=nums[i];
		}
		
	}
}
